package org.example.demo.test.root;


import com.example.demo.test.AbstractStrategyRouter;
import com.example.demo.test.StrategyHandler;
import com.example.demo.test.parm.InClass;
import com.example.demo.test.parm.OutClass;
import com.example.demo.test.search.strategy.first.ABTitleSort;
import com.example.demo.test.search.strategy.first.TitleSort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RootMapper implements AbstractStrategyRouter.StrategyMapper<InClass, OutClass> {

    @Autowired
    private TitleSort titleSort;

    @Autowired
    private ABTitleSort abTitleSort;

    @Override
    public StrategyHandler<InClass, OutClass> get(InClass param) {
        switch (param.getType()){
            case 1:
                return titleSort;
            case 2:
                return abTitleSort;
        }
        return null;
    }

}